package cn.bdqn.hospital.service.impl;

import cn.bdqn.hospital.dao.UserDao;
import cn.bdqn.hospital.dao.impl.UserDaoImpl;
import cn.bdqn.hospital.entity.User;
import cn.bdqn.hospital.service.LoginService;

import java.sql.SQLException;

public class LoginServiceImpl implements LoginService {

    UserDao userDao = new UserDaoImpl();
    /**
     * 登录方法
     */
    @Override
    public boolean login(User user) throws SQLException {
        return userDao.getUserByPwd(user)!=null;
    }
    /**
     * 注册方法
     */
    @Override
    public boolean register(User user) throws SQLException{
        return userDao.add(user)>0;
    }
}
